package cbbx_sm.decision_maker.search;

import cbbx_sm.utils.ExperimentManager;

public class EventFactory {
	protected static Event event = null;
	public static void createEventInstance(double[] possibleValues){
		event = new Event(possibleValues);
	}
	public static Event getInstance(){
		if (event == null){
			
			// Adding the values 0,0.1,0.2,...0.9 as well as 1 and 0.1^3 for possible values=10.
			double[] possibleValues = new double[ExperimentManager.numberOfEventPossibleValues + 2];
			double d = 0;
			int index = 0;
			possibleValues[index++] = d;
			d+=(1/(double)ExperimentManager.numberOfEventPossibleValues);
			
			double smallestAddedValue = 0.01;
			possibleValues[index++] = smallestAddedValue;

			for (; 
					index < ExperimentManager.numberOfEventPossibleValues + 1; 
					d+=(1/(double)ExperimentManager.numberOfEventPossibleValues)) {
				possibleValues[index++] = d;
			}
			possibleValues[index] = 1;
			createEventInstance(possibleValues);
		}
		return event;
	}

}
